package org.september.pisces.user.permission.controller;

import org.september.pisces.user.permission.entity.OperationLog;
import org.september.simpleweb.controller.BaseController;
import org.september.simpleweb.model.ResponseVo;
import org.september.smartdao.CommonDao;
import org.september.smartdao.model.Page;
import org.september.smartdao.model.ParamMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;


@Controller
public class OperationLogController extends BaseController{

	@Autowired
	private CommonDao commonDao;
	
    @RequestMapping(value = List_Page)
    public ModelAndView logList() throws Exception {
        ModelAndView mv = new ModelAndView();
        return mv;
    }

    @ResponseBody
    @RequestMapping(value = List_Data)
    public ResponseVo<Page<OperationLog>> listOperationLogData(Page<OperationLog> page,String username) throws Exception {
        ParamMap pm = new ParamMap();
        pm.put("username", username);
        page = commonDao.findPageByParams(OperationLog.class , page, "PiscesOperationLog.listOperationLog", pm);
        return ResponseVo.<Page<OperationLog>> BUILDER().setData(page).setCode(ResponseVo.BUSINESS_CODE.SUCCESS);
    }
    
    private static final String Mapping_Prefix = "/operationLog";
	public static final String List_Page = Mapping_Prefix+"/logList";
	public static final String List_Data = Mapping_Prefix+"/listOperationLogData";
}
